import { inject } from 'vue';

export function createProgressGuard(router) {
  router.beforeEach((_to, _from, next) => {
    const progress = inject('$progress');
    progress?.start?.();
    next();
  });
  router.afterEach(() => {
    const progress = inject('$progress');
    progress?.done?.();
  });
}
